1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module shumate.PathLayer;
26 
27 private import gdk.RGBA;
28 private import glib.ConstructionException;
29 private import glib.ListG;
30 private import gobject.ObjectG;
31 private import shumate.Layer;
32 private import shumate.LocationIF;
33 private import shumate.Viewport;
34 private import shumate.c.functions;
35 public  import shumate.c.types;
36 
37 
38 /**
39  * A layer displaying line path between inserted [iface@Location] objects
40  * 
41  * This layer shows a connection between inserted objects implementing the
42  * [iface@Location] interface. This means that both #ShumateMarker
43  * objects and [class@Coordinate] objects can be inserted into the layer.
44  * Of course, custom objects implementing the #ShumateLocation interface
45  * can be used as well.
46  */
47 public class PathLayer : Layer
48 {
49 	/** the main Gtk struct */
50 	protected ShumatePathLayer* shumatePathLayer;
51 
52 	/** Get the main Gtk struct */
53 	public ShumatePathLayer* getPathLayerStruct(bool transferOwnership = false)
54 	{
55 		if (transferOwnership)
56 			ownedRef = false;
57 		return shumatePathLayer;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected override void* getStruct()
62 	{
63 		return cast(void*)shumatePathLayer;
64 	}
65 
66 	/**
67 	 * Sets our main struct and passes it to the parent class.
68 	 */
69 	public this (ShumatePathLayer* shumatePathLayer, bool ownedRef = false)
70 	{
71 		this.shumatePathLayer = shumatePathLayer;
72 		super(cast(ShumateLayer*)shumatePathLayer, ownedRef);
73 	}
74 
75 
76 	/** */
77 	public static GType getType()
78 	{
79 		return shumate_path_layer_get_type();
80 	}
81 
82 	/**
83 	 * Creates a new instance of #ShumatePathLayer.
84 	 *
85 	 * Params:
86 	 *     viewport = the @ShumateViewport
87 	 *
88 	 * Returns: a new instance of #ShumatePathLayer.
89 	 *
90 	 * Throws: ConstructionException GTK+ fails to create the object.
91 	 */
92 	public this(Viewport viewport)
93 	{
94 		auto __p = shumate_path_layer_new((viewport is null) ? null : viewport.getViewportStruct());
95 
96 		if(__p is null)
97 		{
98 			throw new ConstructionException("null returned by new");
99 		}
100 
101 		this(cast(ShumatePathLayer*) __p);
102 	}
103 
104 	/**
105 	 * Adds a #ShumateLocation object to the layer.
106 	 * The node is prepended to the list.
107 	 *
108 	 * Params:
109 	 *     location = a #ShumateLocation
110 	 */
111 	public void addNode(LocationIF location)
112 	{
113 		shumate_path_layer_add_node(shumatePathLayer, (location is null) ? null : location.getLocationStruct());
114 	}
115 
116 	/**
117 	 * Gets information whether the path is closed.
118 	 *
119 	 * Returns: %TRUE when the path is closed, %FALSE otherwise
120 	 */
121 	public bool getClosed()
122 	{
123 		return shumate_path_layer_get_closed(shumatePathLayer) != 0;
124 	}
125 
126 	/**
127 	 * Returns the list of dash segment lengths.
128 	 *
129 	 * Returns: the list
130 	 */
131 	public ListG getDash()
132 	{
133 		auto __p = shumate_path_layer_get_dash(shumatePathLayer);
134 
135 		if(__p is null)
136 		{
137 			return null;
138 		}
139 
140 		return new ListG(cast(GList*) __p, true);
141 	}
142 
143 	/**
144 	 * Checks whether the path is filled.
145 	 *
146 	 * Returns: %TRUE if the path is filled, %FALSE otherwise.
147 	 */
148 	public bool getFill()
149 	{
150 		return shumate_path_layer_get_fill(shumatePathLayer) != 0;
151 	}
152 
153 	/**
154 	 * Gets the path's fill color.
155 	 *
156 	 * Returns: the path's fill color.
157 	 */
158 	public RGBA getFillColor()
159 	{
160 		auto __p = shumate_path_layer_get_fill_color(shumatePathLayer);
161 
162 		if(__p is null)
163 		{
164 			return null;
165 		}
166 
167 		return ObjectG.getDObject!(RGBA)(cast(GdkRGBA*) __p, true);
168 	}
169 
170 	/**
171 	 * Gets a copy of the list of all #ShumateLocation objects inserted into the layer. You should
172 	 * free the list but not its contents.
173 	 *
174 	 * Returns: the list
175 	 */
176 	public ListG getNodes()
177 	{
178 		auto __p = shumate_path_layer_get_nodes(shumatePathLayer);
179 
180 		if(__p is null)
181 		{
182 			return null;
183 		}
184 
185 		return new ListG(cast(GList*) __p);
186 	}
187 
188 	/**
189 	 * Gets the path's outline color.
190 	 *
191 	 * Returns: the path's outline color.
192 	 */
193 	public RGBA getOutlineColor()
194 	{
195 		auto __p = shumate_path_layer_get_outline_color(shumatePathLayer);
196 
197 		if(__p is null)
198 		{
199 			return null;
200 		}
201 
202 		return ObjectG.getDObject!(RGBA)(cast(GdkRGBA*) __p, true);
203 	}
204 
205 	/**
206 	 * Gets the width of the outline.
207 	 *
208 	 * Returns: the width of the outline
209 	 */
210 	public double getOutlineWidth()
211 	{
212 		return shumate_path_layer_get_outline_width(shumatePathLayer);
213 	}
214 
215 	/**
216 	 * Checks whether the path is stroked.
217 	 *
218 	 * Returns: %TRUE if the path is stroked, %FALSE otherwise.
219 	 */
220 	public bool getStroke()
221 	{
222 		return shumate_path_layer_get_stroke(shumatePathLayer) != 0;
223 	}
224 
225 	/**
226 	 * Gets the path's stroke color.
227 	 *
228 	 * Returns: the path's stroke color.
229 	 */
230 	public RGBA getStrokeColor()
231 	{
232 		auto __p = shumate_path_layer_get_stroke_color(shumatePathLayer);
233 
234 		if(__p is null)
235 		{
236 			return null;
237 		}
238 
239 		return ObjectG.getDObject!(RGBA)(cast(GdkRGBA*) __p, true);
240 	}
241 
242 	/**
243 	 * Gets the width of the stroke.
244 	 *
245 	 * Returns: the width of the stroke
246 	 */
247 	public double getStrokeWidth()
248 	{
249 		return shumate_path_layer_get_stroke_width(shumatePathLayer);
250 	}
251 
252 	/**
253 	 * Inserts a #ShumateLocation object to the specified position.
254 	 *
255 	 * Params:
256 	 *     location = a #ShumateLocation
257 	 *     position = position in the list where the #ShumateLocation object should be inserted
258 	 */
259 	public void insertNode(LocationIF location, uint position)
260 	{
261 		shumate_path_layer_insert_node(shumatePathLayer, (location is null) ? null : location.getLocationStruct(), position);
262 	}
263 
264 	/**
265 	 * Removes all #ShumateLocation objects from the layer.
266 	 */
267 	public void removeAll()
268 	{
269 		shumate_path_layer_remove_all(shumatePathLayer);
270 	}
271 
272 	/**
273 	 * Removes the #ShumateLocation object from the layer.
274 	 *
275 	 * Params:
276 	 *     location = a #ShumateLocation
277 	 */
278 	public void removeNode(LocationIF location)
279 	{
280 		shumate_path_layer_remove_node(shumatePathLayer, (location is null) ? null : location.getLocationStruct());
281 	}
282 
283 	/**
284 	 * Makes the path closed.
285 	 *
286 	 * Params:
287 	 *     value = %TRUE to make the path closed
288 	 */
289 	public void setClosed(bool value)
290 	{
291 		shumate_path_layer_set_closed(shumatePathLayer, value);
292 	}
293 
294 	/**
295 	 * Sets dashed line pattern in a way similar to cairo_set_dash() of cairo. This
296 	 * method supports only integer values for segment lengths. The values have to be
297 	 * passed inside the data pointer of the list (using the %GUINT_TO_POINTER conversion)
298 	 *
299 	 * Pass %NULL to use solid line.
300 	 *
301 	 * Params:
302 	 *     dashPattern = list of integer values representing lengths
303 	 *         of dashes/spaces (see cairo documentation of cairo_set_dash())
304 	 */
305 	public void setDash(ListG dashPattern)
306 	{
307 		shumate_path_layer_set_dash(shumatePathLayer, (dashPattern is null) ? null : dashPattern.getListGStruct());
308 	}
309 
310 	/**
311 	 * Sets the path to be filled
312 	 *
313 	 * Params:
314 	 *     value = if the path is filled
315 	 */
316 	public void setFill(bool value)
317 	{
318 		shumate_path_layer_set_fill(shumatePathLayer, value);
319 	}
320 
321 	/**
322 	 * Set the path's fill color.
323 	 *
324 	 * Params:
325 	 *     color = The path's fill color or %NULL to reset to the
326 	 *         default color. The color parameter is copied.
327 	 */
328 	public void setFillColor(RGBA color)
329 	{
330 		shumate_path_layer_set_fill_color(shumatePathLayer, (color is null) ? null : color.getRGBAStruct());
331 	}
332 
333 	/**
334 	 * Set the path's outline color.
335 	 *
336 	 * Params:
337 	 *     color = The path's outline color or %NULL to reset to the
338 	 *         default color. The color parameter is copied.
339 	 */
340 	public void setOutlineColor(RGBA color)
341 	{
342 		shumate_path_layer_set_outline_color(shumatePathLayer, (color is null) ? null : color.getRGBAStruct());
343 	}
344 
345 	/**
346 	 * Sets the width of the outline
347 	 *
348 	 * Params:
349 	 *     value = the width of the outline (in pixels)
350 	 */
351 	public void setOutlineWidth(double value)
352 	{
353 		shumate_path_layer_set_outline_width(shumatePathLayer, value);
354 	}
355 
356 	/**
357 	 * Sets the path to be stroked
358 	 *
359 	 * Params:
360 	 *     value = if the path is stroked
361 	 */
362 	public void setStroke(bool value)
363 	{
364 		shumate_path_layer_set_stroke(shumatePathLayer, value);
365 	}
366 
367 	/**
368 	 * Set the path's stroke color.
369 	 *
370 	 * Params:
371 	 *     color = The path's stroke color or %NULL to reset to the
372 	 *         default color. The color parameter is copied.
373 	 */
374 	public void setStrokeColor(RGBA color)
375 	{
376 		shumate_path_layer_set_stroke_color(shumatePathLayer, (color is null) ? null : color.getRGBAStruct());
377 	}
378 
379 	/**
380 	 * Sets the width of the stroke
381 	 *
382 	 * Params:
383 	 *     value = the width of the stroke (in pixels)
384 	 */
385 	public void setStrokeWidth(double value)
386 	{
387 		shumate_path_layer_set_stroke_width(shumatePathLayer, value);
388 	}
389 }